<?php /* Smarty version Smarty-3.1.8, created on 2012-05-30 20:16:27
         compiled from "tmpl/crud_template/controller_edit.html" */ ?>
<?php /*%%SmartyHeaderCode:17473558824fc4918311ba12-80848399%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'b94736739754f6f541df12cbfa97da9dc7d88a20' => 
    array (
      0 => 'tmpl/crud_template/controller_edit.html',
      1 => 1338434116,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '17473558824fc4918311ba12-80848399',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.8',
  'unifunc' => 'content_4fc49183184866_85304176',
  'variables' => 
  array (
    'controller' => 0,
    'table_cols' => 0,
    'col' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_4fc49183184866_85304176')) {function content_4fc49183184866_85304176($_smarty_tpl) {?><<?php ?>?php

require("lib/Util.php");
require_once("<?php echo $_smarty_tpl->tpl_vars['controller']->value;?>
_helper.php");

$tpl_engine = get_tpl_engine();
$db = get_database_handler();

if(is_post()){
  $data=array();

  <?php  $_smarty_tpl->tpl_vars['col'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['col']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['table_cols']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['col']->key => $_smarty_tpl->tpl_vars['col']->value){
$_smarty_tpl->tpl_vars['col']->_loop = true;
?>
$data["<?php echo $_smarty_tpl->tpl_vars['col']->value;?>
"] = param("<?php echo $_smarty_tpl->tpl_vars['col']->value;?>
");
  <?php } ?>
  
  $db->save($data);
  to_path("<?php echo $_smarty_tpl->tpl_vars['controller']->value;?>
_detail.php?id=".param_int("id"));

}else{
  $detail = $db->peek(array("id"=>param_int("id")));
  assign_hash($tpl_engine,$detail);
  $tpl_engine->display('tmpl/<?php echo $_smarty_tpl->tpl_vars['controller']->value;?>
/edit.html');
}


?<?php ?>><?php }} ?>